package com.dfrz.household.controller;/*
 * @创建者：黄苟苟
 * @创建时间：2021/8/17   19:26
 * @Description描述
 **/

import com.dfrz.household.bean.Server;
import com.dfrz.household.service.ServerService;
import com.dfrz.household.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletResponse;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

@RestController
public class ServerController {
    Logger logger = LoggerFactory.getLogger(ServerController.class);
    @Autowired
    ServerService serverService;

    @RequestMapping("toserver")
    public ModelAndView toserver() {
        ModelAndView mv = new ModelAndView();
        List <Server> list = serverService.getAllServers();
        mv.addObject("serverlist", list);
        mv.setViewName("sever");
        return mv;
    }

    @RequestMapping("toserverid")
    public ModelAndView toserverid(Integer id) {
        ModelAndView mv = new ModelAndView();
        Server server = serverService.getServerById(id);
        mv.addObject("serverlist", server);
        mv.setViewName("severid");
        return mv;
    }




}
